﻿using System;
using OneMG.Phoenix.Entity;
using OneMG.Phoenix.Respository;
using IBatisNet.DataMapper;
using OneMG.Phoenix.Kernel.IBatisUtil;
using System.Collections.Generic;

namespace OneMG.Phoenix.IBatisRepository
{
    public class ProductPhotosRepository : BaseIBatisDao,IProductPhotos
    {
        public ProductPhotosRepository()
            : base("yihaoke_newMap.Config")
        {

        }
        public System.Int32 AddProductPhotos(EProductPhotos entity)
        {
			string stmtId = "ProductPhotosMap.InsertProductPhotos";
			 Object obj = base.SqlMapper.Insert(stmtId, entity);
			 return (System.Int32)obj;
        }
        
		public  EProductPhotos GetByPhotoID (System.Int32 photoID)
        {
			string stmtId = "ProductPhotosMap.SelectByPhotoID";
			return base.SqlMapper.QueryForObject<EProductPhotos>(stmtId, photoID);
        }
        
        public  void DeleteByPhotoID (System.Int32 photoID)
        {
			string stmtId = "ProductPhotosMap.DeleteByPhotoID";
			base.SqlMapper.Update(stmtId, photoID);
        }

        public void DeleteByProductID(System.Int32 productID)
        {
            string stmtId = "ProductPhotosMap.DeleteByProductID";
            base.SqlMapper.Update(stmtId, productID);

        }

        
        public  void UpdateByPhotoID (EProductPhotos entity)
        {
			string stmtId = "ProductPhotosMap.UpdateByPhotoID";
			base.SqlMapper.Update(stmtId, entity);
        }

        public IList<EProductPhotos> GetListByProductID(System.Int32 productID)
        {
            string stmtId = "ProductPhotosMap.SelectByProductID";
            return base.SqlMapper.QueryForList<EProductPhotos>(stmtId, productID);
        }


    }
}

